package cn.wsalix.dozer.converter;

import org.dozer.DozerConverter;

import cn.wsalix.type.GenderEnum;

public class GenderStringConverter extends DozerConverter<GenderEnum, String> {
	public GenderStringConverter() {
		super(GenderEnum.class, String.class);
	}

	@Override
	public String convertTo(GenderEnum source, String destination) {
		if(source==null){
			GenderEnum.unknown.getCode();
		}
		return source.getCode();
	}

	@Override
	public GenderEnum convertFrom(String source, GenderEnum destination) {
		return GenderEnum.findByCode(source);
	}

}
